
/* Replication Code:
 * Migrant Inflows and Online Expressions of Regional Prejudice in China
 * Public Opinion Quarterly, 2021
 * Xi Wang, Yang Zhang, Shangguan Wang & Kang Zhao
 */

* Table 1. Descriptive statistics of variables

use prejudice, clear

gen n1 = n * p / 100  // number of prejudiced Weibo users

collapse (sum) n n1 (first) pmigrant-level, by(province city) // collapse the time-series data by cities

gen p = n1 / n * 100  // percentage of prejudiced Weibo users

drop n1

sum p pmigrant* level gdppc pcollege pminority

* Table 2

set more off

drop if n < 100

reg p pmigrant gdppc pcollege pminority
estimates store m1

reg p pmigrant_origin1 pmigrant_job pmigrant_family pmigrant_school gdppc pcollege pminority
estimates store m2

reg p pmigrant_origin1 pmigrant_origin2 gdppc pcollege pminority
estimates store m3

reg p pmigrant_origin1 pmigrant_origin3 pmigrant_origin4 gdppc pcollege pminority
estimates store m4

reg p c.pmigrant##c.level gdppc pcollege pminority
estimates store m5

estout m*, cells(b(star fmt(%9.2f)) se(par)) ///
	 stats(r2 N, fmt(%9.2f %9.0g)) starlevels(* 0.05 ** 0.01)
	
